Page({
  data:{
    img:"",
    product_id:"",
    desc:"",
    user_contact:"",
    user_mobile:"",
    affiliate_id:"",
    product_name:"",
    price:"",
    shop_name:""
  },
  onLoad:function(e){
    console.log(e);
    this.setData({
      img:e.img,
      desc:e.desc,
      user_contact:e.user_contact,
      user_mobile:e.user_mobile,
      product_name:e.product_name,
      price:e.price
    })
    this.data.img=e.img;
    this.data.product_id=e.product_id;
    this.data.desc=e.desc;
    this.data.user_contact=e.user_contact;
    this.data.user_mobile=e.user_mobile;
    this.data.affiliate_id=e.affiliate_id;
    this.data.product_name=e.product_name;
    this.data.price=e.price;
    this.data.shop_name=e.shop_name;
  },
  input1_FN:function(e){
    this.data.user_contact=e.detail.value;
  },
  input2_FN:function(e){
    this.data.user_mobile=e.detail.value;
  },
  suer_FN:function(){
    console.log('1111');
    if(this.data.user_mobile==""){
      wx.showModa({
        title:"提示",
        content:"请输入手机号",
        mask:true,
        showCancel:true
      })
    }else if(this.data.user_contact==""){
      wx.showModa({
        title:"提示",
        content:"请输入姓名",
        mask:true,
        showCancel:true
      })
    }
    var self=this;
    console.log(wx.getStorageSync("user_id"))
    wx.request({
      url:"https://wx.ichelaba.com/htapi/index.php/store/sale/loadPay",
      data:{
        user_id:wx.getStorageSync("user_id"),
        product_id:self.data.product_id,
        user_contact:self.data.user_contact,
        user_mobile:self.data.user_mobile,
        affiliate_id:self.data.affiliate_id
      },
      method:"GET",
      success:function(res){
        console.log(res);
        if(res.data.result){
          var data="img="+self.data.img+
                   "&product_name="+self.data.product_name+
                   "&desc="+self.data.desc+
                   "&order_id="+res.data.order_id+
                   "&price="+self.data.price+
                   "&shop_name="+self.data.shop_name+
                   "&order_number="+res.data.order_no;
          wx.navigateTo({
            url:"/pages/inPage_2/inPage_2?"+data
          })
        }
      }
    })
  }
})